package com.liuboya.dao.weibo.wbhotsearchrank.dao.Impl;

import com.google.common.base.Preconditions;
import com.liuboya.dao.weibo.wbhotsearchrank.dao.WbHotSearchRankDao;
import com.liuboya.dao.weibo.wbhotsearchrank.entity.WbHotSearchRank;
import com.liuboya.dao.weibo.wbhotsearchrank.entity.WbHotSearchRankExample;
import com.liuboya.dao.weibo.wbhotsearchrank.mapper.WbHotSearchRankMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 *
 * 描述：
 *
 * @author yeyuan
 * @date 2021/08/13 15:43
 **/
@Service
public class WbHotSearchRankDaoImpl implements WbHotSearchRankDao {
    @Resource
    private WbHotSearchRankMapper wbhotsearchrankMapper;

    @Override
    public Long insert(WbHotSearchRank wbhotsearchrank) {
        Preconditions.checkNotNull(wbhotsearchrank);
        wbhotsearchrank.checkBeforeInsert();
        wbhotsearchrankMapper.insertSelective(wbhotsearchrank);
        return wbhotsearchrank.getId();
    }

    @Override
    public Integer update(WbHotSearchRank wbhotsearchrank, WbHotSearchRankExample example) {
        wbhotsearchrank.checkBeforeUpdate();
        return wbhotsearchrankMapper.updateByExampleSelective(wbhotsearchrank, example);
    }

    @Override
    public List<WbHotSearchRank> find(WbHotSearchRankExample example) {
        return wbhotsearchrankMapper.selectByExample(example);
    }

    @Override
    public Integer count(WbHotSearchRankExample example) {
        return wbhotsearchrankMapper.countByExample(example);
    }
}